import {
  get,
  post,
  get2,
  getFile,
  deleteFun
} from '../http/axios.js'
import {
  baseUrl,
  ssrBaseUrl
} from '../constant/index'

// 图片存储路径
// const IMG_BASE_URL = baseUrl + '/sys/common/static/'
const IMG_BASE_URL = 'https://dm-bmj.oss-cn-guangzhou.aliyuncs.com/'

const base = {
  baseUrl,
  ssrBaseUrl
}
export const login = (data) => get(`${base.baseUrl}`, data)
export const home = (data) => post(`${base.baseUrl}/api/login`, data)
export const getServiceProvider = (data) => get(`${base.baseUrl}/api/home/randomGetServiceProvider`, data) // 获取服务商信息
export const getPolicyInformation = (data) => get(`${base.baseUrl}/api/home/getPolicyInformation`, data) // 获取政府资讯
export const commonRequest = (path, data) => get(`${base.baseUrl}` + path, data) // get请求的通用接口
export const commonRequestSsr = (path, data) => get(`${base.ssrBaseUrl}` + path, data) // get请求的通用接口
export const postRequest = (path, data) => post(`${base.baseUrl}` + path, data) // post 请求的通过接口
export const postRequestSsr = (path, data) => post(`${base.ssrBaseUrl}` + path, data) // post 请求的通过接口
export const postRequestSplicing = (path, nameValue, data) => post(`${base.baseUrl}${path}?${nameValue}`, data) // post拼接
export const imgBaseUrl = IMG_BASE_URL;
// 政策通知导出
export const noticeDownloadExcel = (data) => getFile(`${base.baseUrl}/api/pms/pmsPolicyNotice/downloadExcel`, data)
// 是否能导出
export const whetherCanExport = (data) => get2(`${base.baseUrl}/api/pms/pmsPolicyNotice/whetherCanExport`, data)
// 充值会员信息
export const getMemberList = (data) => post(`${base.baseUrl}/api/home/getMemberList`, data)
// 获取公司专利缴费列表信息
export const getCompanyPatentPaymentList = (data) => get(`${base.baseUrl}/api/cms/cmsPatent/getCompanyPatentPaymentList`, data)
// 获取公司专利类型
export const getCompanyPatentPayInfo = (data) => get(`${base.baseUrl}/api/cms/cmsPatent/getCompanyPatentPayInfo`, data)
// 专利详情
export const patentInfo = (data) => get(`${base.baseUrl}/api/cms/cmsPatent/patentInfo`, data)
// 获取公司专利缴费年份计算详情
export const getCompanyPatentPayment = (data) => get(`${base.baseUrl}/api/cms/cmsPatent/getCompanyPatentPaymentAnnualFeeComputeInfo`, data)
// 获取公司专利缴费年份计算详情
export const queryPatentNumberWhetherExist = (data) => get(`${base.baseUrl}/api/cms/cmsPatent/queryPatentNumberWhetherExist`, data)
// 专利导出
export const downloadExcel = (data) => getFile(`${base.baseUrl}/api/cms/cmsPatent/downloadExcel`, data)
// 缴费清单
export const getPatentPayInventory = (data) => get(`${base.baseUrl}/api/cms/cmsPatent/getPatentPayInventory`, data)
// 高企预评测工具 - 汇总
export const getHighTechPreEvaluationTool = (data) => get2(`${base.baseUrl}/api/cms/cmsCompany/getHighTechPreEvaluationTool`, data)
// 是否点击下载
export const whetherDownload = (data) => get2(`${base.baseUrl}/api/pms/pmsPolicyNotice/whetherDownload`, data)

// 搜索记录删除
export const deleteSearch = (data) => deleteFun(`${base.baseUrl}/api/cms/cmsSearchRecord/delete`, data)

// 搜索记录列表
export const searchHistoryList = (data) => get2(`${base.baseUrl}/api/cms/cmsSearchRecord/list`, data)

// 标记消息已读
export const updateMassageReadStatus = (data) => post(`${base.baseUrl}/api/ums/umsMessage/updateMassageReadStatus?ids=${data}`, )

// 删除消息
export const deleteMassage = (data) => post(`${base.baseUrl}/api/ums/umsMessage/deleteMassage?ids=${data}`, )

// 获取消息类型
export const getMessageTypeAll = (data) => get2(`${base.baseUrl}/api/ums/umsMessage/getMessageTypeAll`, data)

// 获取未读消息总计
export const getMessageUnreadTotal = (data) => get2(`${base.baseUrl}/api/ums/umsMessage/getMessageUnreadTotal`, data)

// 获取地区(政策通知0，政策解读1)
export const getAllDepartmentArea = (data) => get2(`${base.baseUrl}/api/pms/pmsDepartment/getAllDepartmentArea?type=${data}`)
export const getAllDepartmentAreaSsr = (data) => get2(`${base.ssrBaseUrl}/api/pms/pmsDepartment/getAllDepartmentArea?type=${data}`)

// 获取地区最新资讯)
export const latestNewsRegionInfo = (data) => get2(`${base.baseUrl}/api/pms/pmsLatestNews/latestNewsRegionInfo`, data)
export const latestNewsRegionInfoSsr = (data) => get2(`${base.ssrBaseUrl}/api/pms/pmsLatestNews/latestNewsRegionInfo`, data)

// es政策通知
export const queryPolicyList = (data, domain) => post(`${base.baseUrl}/api/es/Policy/queryPolicyList.json?domain=` + domain, data)
export const queryPolicyListSsr = (data, domain) => post(`${base.ssrBaseUrl}/api/es/Policy/queryPolicyList.json?domain=` + domain, data)

// 根据地区获取地区部门(政策通知)
export const queryRegionDepartmentInfo = (data) => get2(`${base.baseUrl}/api/pms/pmsPolicyNotice/queryRegionDepartmentInfo`, data)
export const queryRegionDepartmentInfoSsr = (data) => get2(`${base.ssrBaseUrl}/api/pms/pmsPolicyNotice/queryRegionDepartmentInfo`, data)

// 取消政策订阅
export const cancelAttention = (id) => post(`${base.baseUrl}/api/home/cancelAttention?departmentId=${id}`)

// 政策订阅
// export const departmentAttention = (id, keywords) => post(`${base.baseUrl}/api/home/departmentAttention?departmentId=${id}&keywords=${keywords}`)
export const departmentAttention = (data) => post(`${base.baseUrl}/api/pms/pmsGovernmentConcerns/departmentAttention`, data)
// 首页订阅部门数据
export const getGovernmentDepartmentsConcerned = (data) => get2(`${base.baseUrl}/api/home/getGovernmentDepartmentsConcerned`, data)

// 最新资讯列表
export const newsList = (data, domain) => get2(`${base.baseUrl}/api/pms/pmsLatestNews/list?domain=` + domain, data)
export const newsListSsr = (data, domain) => get2(`${base.ssrBaseUrl}/api/pms/pmsLatestNews/list?domain=` + domain, data)

// 政策解读列表
export const interpretList = (data, domain) => get2(`${base.baseUrl}/api/pms/pmsPolicyInterpret/list?domain=` + domain, data)
export const interpretListSsr = (data, domain) => get2(`${base.ssrBaseUrl}/api/pms/pmsPolicyInterpret/list?domain=` + domain, data)

// 政策解读地区部门
export const queryPolicyInterpretAcceptDepartment = (data) => get2(`${base.baseUrl}/api/pms/pmsPolicyInterpret/queryPolicyInterpretAcceptDepartment`, data)
export const queryPolicyInterpretAcceptDepartmentSsr = (data) => get2(`${base.ssrBaseUrl}/api/pms/pmsPolicyInterpret/queryPolicyInterpretAcceptDepartment`, data)

// 获取公司详情
export const getCompanyInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsCompany/getCompanyInfo`, data)
export const getCompanyInfoSsr = (data) => get2(`${base.ssrBaseUrl}/api/cms/cmsCompany/getCompanyInfo`, data)

// 缓存地区到后台
export const cacheAreaInfo = (data) => post(`${base.baseUrl}/api/home/cacheAreaInfo`, data)

// 获取后台缓存地区
export const getCacheAreaInfo = (data) => post(`${base.baseUrl}/api/home/getCacheAreaInfo`, data)

// 页面meta配置信息
export const getPageMetaInfo = (data) => get2(`${base.ssrBaseUrl}/api/home/getPageMetaInfo`, data)

// 获取分站信息
export const getSubInfo = (data) => get2(`${base.baseUrl}/api/sys/depart/getSubInfo`, data)
export const getSubInfoSsr = (data) => get2(`${base.ssrBaseUrl}/api/sys/depart/getSubInfo`, data)

// 通过省市获取区域信息
export const queryRegionInfo = (data) => get2(`${base.baseUrl}/api/home/queryRegionInfo`, data)
export const queryRegionInfoSsr = (data) => get2(`${base.ssrBaseUrl}/api/home/queryRegionInfo`, data)

// 查询项目，获取所有省市
export const getProjectRegionInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsHonorProject/getProjectRegionInfo`, data)

// 查询项目，获取所有部门
export const getProjectDepartmentInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsHonorProject/getProjectDepartmentInfo`, data)

// 查询项目，获取所有级别
export const getProjectLevelInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsHonorProject/getProjectLevelInfo`, data)

// 查询项目，获取所有行业
export const getProjectIndustryInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsHonorProject/getProjectIndustryInfo`, data)

// 查询项目，获取所有类别
export const getProjectTypeInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsHonorProject/getProjectTypeInfo`, data)

// 查询项目列表
export const getProjectList = (data) => post(`${base.baseUrl}/api/es/project/query.json`, data)

// 获取公司申报政策信息
export const getCompanyDeclarePolicyInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsCompany/getCompanyDeclarePolicyInfo`, data)

// 获取公司申报政策信息
export const exportCompanyInfo = (data) => getFile(`${base.baseUrl}/api/cms/cmsCompany/exportCompanyInfo`, data)

// 获取用户信息
export const userInfo = (data) => get2(`${base.baseUrl}/api/userInfo`, data)

// 获取分站配置
export const getDomainConfig = (data) => get2(`${base.baseUrl}/api/home/getDomainConfig`, data)

// 获取地区订阅部门
export const getPolicyDepartmentSubscribeInfo = (data) => get2(`${base.baseUrl}/api/pms/pmsDepartment/getPolicyDepartmentSubscribeInfo`, data)

// 获取随机订阅部门
export const randomObtainDepartment = (data) => get2(`${base.baseUrl}/api/pms/pmsDepartment/randomObtainDepartment`, data)

// 获取政策地图数据
export const getPolicyAtlas = (data) => get2(`${base.baseUrl}/api/pms/pmsPolicyNotice/getPolicyAtlas`, data)

// 项目图谱地图数据
export const getProvinceProjectAmount = (data) => get2(`${base.baseUrl}/api/project/getProvinceProjectAmount`, data)

// 项目图谱行业之星
export const getProjectIndustryStar = (data) => get2(`${base.baseUrl}/api/project/getProjectIndustryStar`, data)

// 获取部门订阅关键字
export const getDepartmentKeywordsConfig = (data) => get2(`${base.baseUrl}/api/home/getDepartmentKeywordsConfig`, data)

// 项目图谱右侧数据总汇
export const getMapSummaryInfo = (data) => get2(`${base.baseUrl}/api/cms/cmsMapSummary/getMapSummaryInfo`, data)

// 科技成果列表
export const achievementsList = (data) => get2(`${base.baseUrl}/api/science/scienceAchievements/list`, data)
export const achievementsListSsr = (data) => get2(`${base.ssrBaseUrl}/api/science/scienceAchievements/list`, data)

// 科技成果列表详情
export const achievementsDetail = (data) => get2(`${base.baseUrl}/api/science/scienceAchievements/detail`, data)

// 科技成果新增
export const achievementsAdd = (data) => post(`${base.baseUrl}/api/science/scienceAchievements/add`, data)

// 科技成果修改
export const achievementsUpdate = (data) => post(`${base.baseUrl}/api/science/scienceAchievements/update`, data)

// 科技成果删除
export const achievementsDelete = (data) => post(`${base.baseUrl}/api/science/scienceAchievements/delete`, data)

// 我的科技成果列表
export const myScienceAchievements = (data) => get2(`${base.baseUrl}/api/science/scienceAchievements/myScienceAchievements`, data)

// 科技成果获取地区
export const resultAreaInfo = (data) => get2(`${base.baseUrl}/api/science/scienceAchievements/areaInfo`, data)

// 科技成果需求列表
export const demandList = (data) => get2(`${base.baseUrl}/api/science/scienceAchievementsDemand/list`, data)
export const demandListSsr = (data) => get2(`${base.ssrBaseUrl}/api/science/scienceAchievementsDemand/list`, data)

// 科技成果需求列表详情
export const demandDetail = (data) => get2(`${base.baseUrl}/api/science/scienceAchievementsDemand/detail`, data)

// 科技成果新增
export const demandAdd = (data) => post(`${base.baseUrl}/api/science/scienceAchievementsDemand/add`, data)

// 科技成果修改
export const demandUpdate = (data) => post(`${base.baseUrl}/api/science/scienceAchievementsDemand/edit`, data)

// 科技成果删除
export const demandDelete = (data) => post(`${base.baseUrl}/api/science/scienceAchievementsDemand/delete`, data)

// 我的科技成果列表
export const myScienceAchievementsDemandList = (data) => get2(`${base.baseUrl}/api/science/scienceAchievementsDemand/myScienceAchievementsDemandList`, data)

// 首页底部企业列表
export const getSerivice = (data) => get2(`${base.baseUrl}/api/cms/cmsBusinessCard/list`, data)

// 最新资讯详情
export const getNewsDetail = (id) => get2(`${base.baseUrl}/api/pms/pmsLatestNews/detail/${id}`)
export const getNewsDetailSsr = (id) => get2(`${base.ssrBaseUrl}/api/pms/pmsLatestNews/detail/${id}`)

// 政策通知详情
export const queryPolicyNoticeDetail = (data) => post(`${base.baseUrl}/api/es/Policy/queryPolicyNoticeDetail`, data)


export const getByIdCompanyBusinessCardInfo = (id) => get2(`${base.baseUrl}/api/cms/cmsBusinessCard/getByIdCompanyBusinessCardInfo/${id}`)
